﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
public partial class admin_View_WO : System.Web.UI.Page {
    protected void Page_Load(object sender, EventArgs e) {

    }
    protected void FormViewWorkOrders_PreRender(object sender, EventArgs e) {
        //Int32 i = default(Int32);
        //Int32 CurrentRecord = Convert.ToInt32(Request.QueryString["user_id"].ToString());

        //// Get the ID for the last (newest) record
        //if (Session["newrecord"] == true) {
        //    System.Data.OleDb.OleDbConnection oConn = new System.Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("VFPLibrary").ConnectionString);
        //    string SQL = "SELECT top 1 * FROM users ORDER BY user_id desc ";

        //    using (oConn) {
        //        System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand(SQL);
        //        command.Connection = oConn;
        //        oConn.Open();
        //        System.Data.OleDb.OleDbDataReader oReader = command.ExecuteReader();

        //        oReader.Read();
        //        // Call Read before accessing data.
        //        CurrentRecord = oReader["user_id"];
        //        oReader.Close();
        //        // Call Close when done reading.
        //        oConn.Close();
        //    }
        //    Session("newrecord") = false;
        //}

        ////Go to the record we want
        //for (i = 0; i <= FormViewWorkOrders.DataItemCount - 1; i++) {
        //    FormViewWorkOrders.PageIndex = i;
        //    if (FormViewWorkOrders.DataItem("workorder_id") == CurrentRecord) {
        //        break; // TODO: might not be correct. Was : Exit For
        //    }
        //}

        //for (int rowindex = 0; rowindex < FormViewWorkOrders.DataItemCount; rowindex++) {
        //    if (FormViewWorkOrders.DataKey[rowindex].ToString() == Request.QueryString["workorder_id"]) { 
        //        FormViewWorkOrders.PageIndex = ++rowindex; 
        //        break; 
        //    }
        //}
    }
    protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
    {


        Session.Contents.Remove("UserDetails");
        Session.Abandon();
        Session.Contents.RemoveAll();
        FormsAuthentication.SignOut();
        Response.Redirect("../Default.aspx");
    }

}
